package com.mystudy.springcloud.controller;

import com.mystudy.springcloud.entities.CommonResult;
import com.mystudy.springcloud.service.AccountService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.math.BigDecimal;

@RestController
public class AccountController {
	/**
	 * 服务对象
	 */
	@Resource
	private AccountService accountService;

	/**
	 * @功能: 扣减余额
	 */
	@PostMapping(value = "/account/decrease")
	CommonResult decrease(@RequestParam("userId") Long userId, @RequestParam("money") BigDecimal money) {
		accountService.decreaseAccount(userId, money);
		return new CommonResult(200, "扣减余额完成！");
	}
}